/*
 * Copyright (C) 2010 by Lei Shi (sjtushi@gmail.com)
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License, 
 * version 2, or any later versions.
 */

/*
 * Implement a simple stack used to trace directory tree.
 */

#ifndef _XEN_LSOF_STACK_H_
#define _XEN_LSOF_STACK_H_

#include "proc.h"

/* 
 * stack definition used in trace the directory tree to generate 
 * full path of file.
 */
#define STACK_SIZE       10
#define STACK_STR_LENGTH 100
#define STACK_EMPTY_STATUS     0
#define STACK_FULL_STATUS      10

typedef struct {
   int top;
   char dir_stack[STACK_SIZE][STACK_STR_LENGTH];
} stack_t;

int init_stack(stack_t *);
int push_stack(stack_t *, char*);
char* pop_stack(stack_t *);
int isempty_stack(stack_t *);
int isfull_stack(stack_t *);

/* process opened file related information */

#endif // _XEN_LSOF_STACK_H_
